package com.cuckoo.mall.network;

import com.bgn.baseframe.network.bean.TDataBean;
import com.cuckoo.mall.javabean.CartItems;
import com.cuckoo.mall.javabean.CartProductItem;
import com.cuckoo.mall.javabean.Category;
import com.cuckoo.mall.javabean.Fliter;
import com.cuckoo.mall.javabean.Goods;
import com.cuckoo.mall.javabean.MessageActive;
import com.cuckoo.mall.javabean.MessageOrder;
import com.cuckoo.mall.javabean.MessageStateData;
import com.cuckoo.mall.javabean.Order;
import com.cuckoo.mall.javabean.OrderResult;
import com.cuckoo.mall.javabean.PostAddress;
import com.cuckoo.mall.javabean.Product;
import com.cuckoo.mall.javabean.SearchResultData;
import com.cuckoo.mall.javabean.Ticket;
import com.cuckoo.mall.javabean.UrlBean;
import com.cuckoo.mall.javabean.UserData;
import com.cuckoo.mall.javabean.UserInfo;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * 作者：wl on 2017/9/21 13:50
 * 邮箱：wanglun@stosz.com
 */
public interface RetrofitApi {
    /*获取首页数据*/
    @POST(Constants.FUNCTION_INDEX)
    Observable<TDataBean<Goods>> getIndexData();

    /*登录*/
    @POST(Constants.FUNCTION_LOGIN)
    Observable<TDataBean<UserInfo>> login(@Body Map<String, String> map);

    /*注册*/
    @POST(Constants.FUNCTION_REGISTER)
    Observable<TDataBean<UserInfo>> register(@Body Map<String, String> map);

    /*第三方登录*/
    @POST(Constants.FUNCTION_THRID_PART_LOGIN)
    Observable<TDataBean<UserInfo>> thirdPartLogin(@Body Map<String, String> map);

    /*忘记密码*/
    @POST(Constants.FUNCTION_FORGET_PWD)
    Observable<TDataBean<String>> forgetPasswod(@Body Map<String, String> map);

    /*获取用户信息*/
    @POST(Constants.FUNCTION_USER_INFO)
    Observable<TDataBean<UserData>> getUserData(@Body Map<String, String> map);

    /*自动登录*/
    @POST(Constants.FUNCTION_AUTO_LOGIN)
    Observable<TDataBean> autoLogin(@Body Map<String, String> map);

    /*获取所有种类*/
    @GET(Constants.FUNCTION_GET_ALL_CATEGORY)
    Observable<TDataBean<List<Category>>> getAllCategories(@QueryMap Map<String, String> map);
    // Observable<TDataBean<List<Category>>> getAllCategories(@Query("user_id") String user_id, @Query("sign") String sign, @Query("ts") int ts);

    /*获取所有种类*/
    @GET(Constants.FUNCTION_GET_HOME_CATEGORY)
    Observable<TDataBean<List<Category>>> getHomeCategories(@QueryMap Map<String, String> map);
    //Observable<TDataBean<List<Category>>> getHomeCategories(@Query("ismale") int ismale, @Query("user_id") String user_id, @Query("sign") String sign, @Query("ts") int ts);

    /*获取分类下的商品列表*/
    @GET(Constants.FUNCTION_GET_GOODS_BY_CATEGORY)
    Observable<TDataBean<List<Goods>>> getGoodsList(@QueryMap Map<String, String> map);

    /*搜索商品*/
    @POST(Constants.FUNCTION_GET_GOODS_BY_SEARCH)
    Observable<TDataBean<SearchResultData>> searchList(@Body Map<String, String> map);

    /*获取home商品列表*/
    @GET(Constants.FUNCTION_GET_HOME_GOODS_BY_CATEGORY)
    Observable<TDataBean<List<Goods>>> getHomeGoodsList(@QueryMap Map<String, String> map);

    /*获取home Recommon商品列表*/
    @GET(Constants.FUNCTION_GET_HOME_GOODS_RECOMMON)
    Observable<TDataBean<List<Goods>>> getHomeRecommonList(@QueryMap Map<String, String> map);

    /*获取商品详情*/
    @GET(Constants.FUNCTION_GET_GOOD_INFO)
    Observable<TDataBean<Product>> getGoodInfo(@QueryMap Map<String, String> map);

    /*收藏*/
    @POST(Constants.FUNCTION_POST_GOOD_ADD_FAVORITE)
    Observable<TDataBean> addFavorite(@Body Map<String, String> map);

    /*取消收藏*/
    @POST(Constants.FUNCTION_POST_GOOD_DEL_FAVORITE)
    Observable<TDataBean> cancleFavorite(@Body Map<String, String> map);

    /*收藏列表*/
    @POST(Constants.FUNCTION_POST_GOOD_FAVORITE_LIST)
    Observable<TDataBean<List<Product>>> loadFavoriteList(@Body Map<String, String> map);

    /*购物车列表*/
    @POST(Constants.FUNCTION_POST_GOOD_CART_LIST)
    Observable<TDataBean<List<CartProductItem>>> loadCartList(@Body Map<String, String> map);

    /*加入购物车*/
    @POST(Constants.FUNCTION_POST_GOOD_ADD_CART)
    Observable<TDataBean> addToCart(@Body Map<String, String> map);

    /*移除购物车*/
    @POST(Constants.FUNCTION_POST_GOOD_DELETE_CART)
    Observable<TDataBean> removeFromCart(@Body Map<String, String> map);

    /*修改购物车数量*/
    @POST(Constants.FUNCTION_POST_GOOD_SET_CART_ITEM_NUMS)
    Observable<TDataBean> updateCartItemNums(@Body Map<String, String> map);

    /*购物车移动到新元旦*/
    @POST(Constants.FUNCTION_POST_GOOD_CART_MOVE_FAVORITE)
    Observable<TDataBean> moveToFavorite(@Body Map<String, String> map);

    /*创建订单*/
    @POST(Constants.FUNCTION_POST_ORDER_CREAT)
    Observable<TDataBean<OrderResult>> createOrder(@Body Map<String, String> map);

    /*创建订单*/
    @POST(Constants.FUNCTION_POST_ORDER_CREAT_BY_PRODUCT)
    Observable<TDataBean<OrderResult>> createOrderByProduc(@Body Map<String, String> map);

    /*cod付款*/
    @POST(Constants.FUNCTION_POST_ORDER_SET_COD)
    Observable<TDataBean<Order>> setOrderCOD(@Body Map<String, String> map);

    /*加载订单列表*/
    @POST(Constants.FUNCTION_POST_ORDER_LOAD_LIST)
    Observable<TDataBean<List<Order>>> loadOrderList(@Body Map<String, String> map);

    /*DELETE订单*/
    @POST(Constants.FUNCTION_POST_ORDER_DELETE)
    Observable<TDataBean> deleteOrder(@Body Map<String, String> map);

    /*MODIFY USERINFO*/
    @POST(Constants.FUNCTION_POST_MODIFY_USER_INFO)
    Observable<TDataBean> modifyUserInfo(@Body Map<String, String> map);

////    /*MODIFY*/
//    @POST(Constants.FUNCTION_POST_MODIFY_HEAD_IMAGE)
//    Observable<TDataBean<UrlBean>> uploadHeadImage(@Part MultipartBody.Part img, @Part("user_id") RequestBody user_id, @Part("ts") RequestBody ts, @Part("sign") RequestBody sign);

    /*MODIFY IMAGE*/
    @Multipart
    @POST(Constants.FUNCTION_POST_MODIFY_HEAD_IMAGE)
    Observable<TDataBean<UrlBean>> uploadHeadImage(@PartMap Map<String, RequestBody> params);

    /*INPOUT INVITE CODE*/
    @POST(Constants.FUNCTION_POST_INPUT_INVITE_CODE)
    Observable<TDataBean> inputInViteCode(@Body Map<String, String> map);

    /*CHECK NEW MESSAGE STATE*/
    @POST(Constants.FUNCTION_POST_CHECK_NEW_MESSAGE)
    Observable<TDataBean<MessageStateData>> checkNewMessage(@Body Map<String, String> map);

    /*GET MESSAGE ACTIVE LIST*/
    @POST(Constants.FUNCTION_POST_MESSAGE_ACTIVE_LIST)
    Observable<TDataBean<List<MessageActive>>> getMessageActiveList(@Body Map<String, String> map);

    /*GET MESSAGE ORDER LIST*/
    @POST(Constants.FUNCTION_POST_MESSAGE_ORDER_LIST)
    Observable<TDataBean<List<MessageOrder>>> getMessageOrderList(@Body Map<String, String> map);

    @POST(Constants.FUNCTION_POST_ORDER_DELETE_RECOMMND_LIST)
    Observable<TDataBean<List<Goods>>> getGoodDetaildRecommndList(@Body Map<String, String> map);

    @POST(Constants.FUNCTION_POST_GOODS_RECENTLY_LIST)
    Observable<TDataBean<List<Product>>> getRecentlyViewdList(@Body Map<String, String> map);

    @POST(Constants.FUNCTION_POST_GOODS_SEARCH_CATEGORY)
    Observable<TDataBean<List<Fliter>>> getSearchResultCategory(@Body Map<String, String> map);

    /*THUS*/
    /*GET MESSAGE ORDER LIST*/
    @GET(Constants.FUNCTION_POST_GOODS_GET_LIST_BY_ID)
    Observable<TDataBean<List<Product>>> getProductList(@QueryMap Map<String, String> map);

    @POST(Constants.FUNCTION_POST_ORDER_DETAIL)
    Observable<TDataBean<Order>> getOrderDetailById(@Body Map<String, String> map);

    @POST(Constants.FUNCTION_POST_GET_ADDRESS_BY_CODE)
    Observable<TDataBean<PostAddress>> getAddressByCode(@Body Map<String, String> map);

    @POST(Constants.FUNCTION_POST_GET_ALL_TICKET)
    Observable<TDataBean<List<Ticket>>> getAllTickets(@Body Map<String, String> map);

}
